/*关闭弹窗*/
$(function(){
    var $headImage =$('#head-image');
    var $close = $("#close");
    var $mask = $('#mask');
    var $toggle=$('#toggle');
    var $music = $('#music');
    var $word = $('#word');
    var $bigPhoto =$('#bigPhoto');
    $toggle.on('tap',function(e){
        var $this = $(this);
        var checkCase = $this.hasClass('word-text');
        if(!!checkCase){
            $this.removeClass('word-text');
            $music.show();
            $word.hide();
        }else{
            $this.addClass('word-text');
            $music.hide();
            $word.show();
        }
        e.stopPropagation();
        e.preventDefault();
        return false;
    })
    $headImage.on('tap',function(e){
        $mask.show();
        $bigPhoto.show();
        photoScale('.pinch-zoom');
        e.stopPropagation();
        e.preventDefault();
        return false;
    });
	$close.on('tap',function(e){
       $(this).parent().hide();
       $mask.hide();
       e.stopPropagation();
       e.preventDefault();
       return false;
    });
    $bigPhoto.on('touchmove',function(e){
        e.stopPropagation();
        e.preventDefault();
        return false;
    })
    /*通过滚动条来判断顶部*/
    var $header = $('#wrapper');
    var $endways = $('#endways');
    var $sidewards =$('#sidewards');
    var $btnToggle =$('#btn-toggle');
    var endwaysHeight = $sidewards.height();
    $(window).on("scroll",function (e) {
        if($(this).scrollTop()>=endwaysHeight){
        $header.addClass('active');
        $endways.hide();
        $sidewards.show();
        $btnToggle.addClass('btn');
    }else{
        $header.removeClass('active');
        $endways.show();
        $sidewards.hide();
        $btnToggle.removeClass('btn');
    }
    });
    

})

